package com.onetwork.core.actions;

import com.onetwork.core.ui.components.BasicWindow;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

public class OpenMainWindowBundleAction extends AbstractAction {
    private static final long serialVersionUID = 1L;
    private final BasicWindow basicPanel;
    private final OpenWindowListener openWindowListener;
    
    public OpenMainWindowBundleAction(BasicWindow basicPanel, OpenWindowListener openWindowListener) {
        super(basicPanel.getName(), basicPanel.icon());
        this.putValue(SHORT_DESCRIPTION, basicPanel.getName());
        this.basicPanel = basicPanel;
        this.openWindowListener = openWindowListener;
    }
    
    public BasicWindow basicWindow() {
        return this.basicPanel;
    }
    
    @Override
    public void actionPerformed(ActionEvent event) {
        this.openWindowListener.openWindow(basicPanel);
    }
}
